package com.bjpowernode.app.autoconfigure;

import com.bjpowernode.app.autoconfigure.properties.PageInfoProperties;
import com.bjpowernode.app.vo.PageInfo;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(PageInfoProperties.class)
public class PageInfoAutoConfiguration {
    @Bean
    //方法返回的类，就是Spring容器中该类的对象，意味着该对象是我们需要的业务逻辑对象
    //直接挂参数使用外部配置
    public PageInfo pageInfo(PageInfoProperties pageInfoProperties) {
        PageInfo pageInfo = new PageInfo();
        //该属性使用的是自动装配配置的[每页多少行]
        pageInfo.setPageSize(pageInfoProperties.getPageSize());
        return pageInfo;
    }
}

